#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#define fill(a, c) memset(a, c, sizeof(a))
#define ldb long double
#define LL long long
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define sqr(a) ((a) * (a))
#define debug(a) cerr << #a << " = " << a << " ";
#define debugl(a) cerr << #a << " = " << a << "\n";
const ldb eps = 1e-9;
const ldb LDINF = 1e70;
const LL LINF = 1ll << 60;
const int INF = 1 << 30;
const ldb pi = fabs(atan2(0.0, -1.0));
using namespace std;

int n, k;
vector <int> res[100010];
int a[100010];
int mx[100010];

void Load()
{
	scanf("%d%d", &n, &k);
	int i;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
   	}
}

bool check(int from, int i)
{
	int k;
	for (k = i; k < n; k++)
	{
		
	}
}

void Solve()
{
	sort(a, a + n);
	int i;
	int cnt = 0;
	int j = 0;
	int lst = 0;
	for (i = 0; i < n / k; i++) res[i].resize(0);
	cnt = 0;
	mx[n] = 0;
	for (i = n - 1; i >= 0; i--)
	{
		if (i == n - 1) mx[i] = 0;
		else if (a[i] != a[i + 1])
		{
			cnt = 0;
		}
		cnt++;
		mx[i] = max(cnt, mx[i + 1]);

	}
	#ifdef JUG_DEBUG
		for (i = 0; i < n; i++)
			cerr << a[i] << " ";
			cerr << "\n";
	#endif
	cnt = 0;
	for (i = 0; i < n; i++)
	{

		if (i > 0 && a[i - 1] != a[i])
		{
			cnt = 0;
			j = lst;
		}
		if (cnt == n / k)
		{
			printf("-1\n");
			return;
		}

		res[j].push_back(a[i]);
		while (!check(j, i + 1))
		{
			res[j].pop_back();
			j = j + 1;
			if (j == n / k) j = lst;
			while (res[j].size() == k)
			{
				j = j + 1;
				if (j == n / k) j = lst;
			}
			res[j].push_back(a[i]);
		}

		if (j < n / k && res[j].size() == k)
		{
			while (j < n / k && res[j].size() == k)
			{
				if (lst == j)
					lst = j + 1;
				j++;
			}
		}
		else j++;
		if (j >= n / k) j = lst;
		cnt++;
	}
	for (i = 0; i < n / k; i++)
	{
		for (j = 0; j < k; j++)
			printf("%d ", res[i][j]);
	}
	printf("\n");
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("in", "rt", stdin);
	freopen("out", "wt", stdout);
#endif
	int t;
	cin >> t;
	int i;
	for (i = 0; i < t; i++)
	{
		Load();
		Solve();
	}
	return 0;
}
